/*
 * Licensed under the License, Version 1.0 (the "License");
 * You may obtain a copy of the License at
 *   http://www.heavenick.com/license/License 
 * Copyright information Heavenick to all.
 * Unless the applicable legal requirements or written 
 * consent, can use or around the code, and no warranties 
 * of any kind and state responsibility.
 */
package com.heavenick.generator.internal.util;

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

/**
 * 
 * @author Heavenick
 * @version 1.0
 * @date 2012-9-24 下午10:07:38
 */
public class Message {
	private static final String BUNDLE_NAME = "com.heavenick.generator.internal.util.messages.messages.properties";

	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
			.getBundle(BUNDLE_NAME);

	private Message() {
	}

	public static String getString(String key,String message) {
		String[] messages = message.split(",");
		try {
			return MessageFormat.format(RESOURCE_BUNDLE.getString(key),messages);
		} catch (MissingResourceException e) {
			return '!' + key + '!';
		}
	}
}
